{% init files = [] %}
{% init pseudo_groups = False %}

<div class="col-md-12">
    <table id="fileTable" class="col-md-12 table">

    {% if pseudo_groups %}
        <tr>
            <td class="note-td">
                <img src="/static/image/folder.gif">
                <a href="/file/group/ungrouped">未分类</a>
            </td>
        </tr>
        <tr>
            <td class="note-td">
                <img src="/static/image/folder.gif">
                <a href="/file/group/public">公开</a>
            </td>
        </tr>
    {% end %}

    {% for i, item in enumerate(files) %}
        <tr>
            <td class="note-td">
                {% if item.type == "group" %}
                    <img src="/static/image/folder.gif"/>
                    <a class="group-link" href="/file/view?id={{item.id}}" id="file-{{item.id}}">{{item.name}}</a>({{item.size}})
                {% else %}
                    <a class="note-link" href="/file/view?id={{item.id}}" id="file-{{item.id}}">{{item.name}}</a>
                    ({{item.creator}})
                {% end %}

                {% if _has_login %}
                <div style="float: right;">
                    <a class="item-option" href="javascript:rename({{item.id}}, '{{item.name}}')">重命名</a>
                    {% if _is_admin %}
                        <a class="item-option" href="javascript:remove({{item.id}}, '{{item.name}}')">删除</a>
                    {% end %}
                    {% if item.type != "group" %}
                    <a class="item-option dialog-btn" dialog-url="/file/group?id={{item.id}}&filetype=xml" href="javascript:void({{item.id}})">移动</a>
                    {% end %}
                </div>
                {% end %}
            </td>
        </tr>
    {% end %}
    </table>
</div>

{% if "page" in globals() %}
    {% include mod_pagenation.html %}
{% end %}
